

<!-- Job heading to be displayed if only adding new JobVersion -->
<?php if( !$addNewJob && !$editJob): ?>
<div>
  <?php /*debug($job);*/ ?>
  <h2>Job: <?= $job['Job']['name']; ?></h2>
  
  <table cellpadding="0" cellspacing="0">
    <tr>
      <th>Alternate Job Name</th>
      <th>Description</th>
			<th>Directory Name</th>
			<th>Created</th>
    </tr>
    <tr>
      <td><?php echo $job['JobAltName']['name'] ?>&nbsp;</td>
      <td><?php echo $job['Description']['content'] ?>&nbsp;</td>
      <td><?php echo $job['Job']['dir_name']; ?>&nbsp;</td>
      <td><?php echo $job['Job']['created']; ?>&nbsp;</td>
    </tr>
  </table>
</div>
<?php endif; ?>

<div class="jobs form">
  
<?php  // the 'url' param of create() lets me pass the state vars back to the conroller again 
echo $this->Form->create('Job', array('url' => array($job_id, 
                                                     $template_version_id, 
                                                     $edit_job_id, 
                                                     $edit_version_id) ));
?>
  <?php 
  //////////////////////////////////////////////////////////////////////
  /////////////// JOB Fields ///////////////////////////////////////////
  if($addNewJob || $editJob):
  ?>
  
	<fieldset>
		<legend> <?php echo $addNewJob ? 'Add Job' : 'Edit Job'; ?></legend>
    <?php
    if($editJob) {
      echo $this->Form->input('id');
      echo $this->Form->input('JobAltName.id');
      echo $this->Form->input('Description.id');
    }
    
		echo $this->Form->input('name' /*, array('after'=>'<p class="guidance">Must be unique</p>')*/);
    echo $this->Form->input('JobAltName.name', array('label'=>'Alternate Job Name',
                                                     // Add a CSS class to basically remove 'required' class:
                                                     'div' => 'override_required'));
		echo $this->Form->input('dir_name', array('label'=>'Job Directory Name'));
		echo $this->Form->input('dir_abs_path', array('label'=>'Absolute path to Job Directory'));
    
    echo $this->Form->input('Description.content', array('label'=>'Job Description',
                                                         'rows' =>'3',
                                                          // Add a CSS class to basically remove 'required' class:
                                                          'div' => 'override_required'));
		//echo $this->Form->input('Tag.Tag');
    
    echo $form->input('Tag.name',array(
    //echo $form->input('JobsTag.Tag.name',array(
                        'type' => 'textarea',
                        'rows' => '2',
                        'label' => 'Tags',
                        'after' => '<span class="guidance">'
                               .'Seperate each tag with a comma.  Eg: family, sports, icecream</span>',
                        'div' => 'override_required'));

    
    ?>
 
	</fieldset>

  
  <?php endif; // end if($addNewJob) 
  //////////////////////////////////////////////////////////////////////////////
  /////////////// JOB VERSION Fields ///////////////////////////////////////////
  if($addNewJobVersion || $editJobVersion):
  ?>

  <fieldset>
    <legend> <?php echo $addNewJobVersion ? 'Add Job Version' : 'Edit Job Version'; ?></legend>


    <?php
    if($editJobVersion) {
      echo $this->Form->input('JobVersion.id');
      echo $this->Form->input('JobVersionName.id');
      echo $this->Form->input('JobVersionComment.0.id');
      echo $this->Form->input('CudaJob.id');
    }
    
    
    echo $this->Form->input('JobVersionName.name', array('label'=>'Version Name',
                                                         'after'=>
                                                         '<p class="guidance">Should be unique within this Job</p>'));
    
    echo $this->MyForm->inputsDisabledAndHidden('JobVersion.version_num', 
                                                array('label'=>'Version Number',
                                                      'after'=>
                                                      '<p class="guidance">Count your blessings... or at least your iterations!</p>'));
    
    echo $this->MyForm->inputsDisabledAndHidden('JobVersion.status_id'); 

    echo $this->Form->input('JobVersion.author_id',   array('after'=>
                                                            '<p class="guidance">Go ahead, take credit!</p>'));
    echo $this->Form->input('JobVersionComment.0.comment', array('label'=>'Comment about this version',
                                                                 'rows' =>'3'));
    
		echo $this->Form->input('JobVersion.job_type_id', array('empty'=>'Choose...'));
    
    
    
    ?>
  
  </fieldset>
  <?php ///////////////////////////////////////// 
  endif; // end if($addNewJobVersion) ///////////
  ?> 
  
<?php echo $this->Form->end(__('Submit', true));?>

</div>


<!-- MENU -->
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>

		<li><?php echo $this->Html->link(__('List Jobs', true), array('action' => 'index'));?></li>
		<li><?php echo $this->Html->link(__('List Statuses', true), array('controller' => 'statuses', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Status', true), array('controller' => 'statuses', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Authors', true), array('controller' => 'authors', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Author', true), array('controller' => 'authors', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Job Types', true), array('controller' => 'job_types', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Job Type', true), array('controller' => 'job_types', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Descriptions', true), array('controller' => 'descriptions', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Description', true), array('controller' => 'descriptions', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Job Alt Names', true), array('controller' => 'job_alt_names', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Job Alt Name', true), array('controller' => 'job_alt_names', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Param Fdks', true), array('controller' => 'param_fdks', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Param Fdk', true), array('controller' => 'param_fdks', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Param Sirts', true), array('controller' => 'param_sirts', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Param Sirt', true), array('controller' => 'param_sirts', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Cuda Jobs', true), array('controller' => 'cuda_jobs', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Cuda Job', true), array('controller' => 'cuda_jobs', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Tags', true), array('controller' => 'tags', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Tag', true), array('controller' => 'tags', 'action' => 'add')); ?> </li>
	</ul>
</div>